// ========================================================================
// Player class
// Decription: Creates a new player with certain statistics, sets the
// player's 5 cards, and allows player to place a bet.
// ========================================================================

public class Player {
	// Declare instance variables
	private int gamesPlayed;
	private int gamesWon;
	private final double INITIAL_CASH = 1000.0;
	private double playerCash;
	public final String playerName;
		
	private int playerCards = new int[5];	

	public Player(String playerName) {							// Player Constructor
		this.playerName = playerName.toLowerCase();
		gamesPlayed = 0;
		gamesWon = 0;
		playerCash = INITIAL_CASH;
	}

	// The following 2 methods should be in the game class
	/*
	public void readPlayer(String player) throws FileNotFoundException {			// method to read from file
		searchFile();
		if (searchFile) {
			// load stats to game
		}
	}
	
	public void writePlayer(String player) throws FileNotFoundException {		// method to write to a file
		// Overwrites old file with new statistics
		searchFile();
		if (searchFile()) {
			// write the stats to the file in the proper order
		}
	}
	*/
	public int getName() { return this.playerName; }
	
	public int getGamesPlayed() { return this.gamesPlayed; }
	
    public int getGamesWon() { return this.gamesWon; }
	
    public int getGamesLost() { return this.gamesPlayed - this.gamesWon; }
        
    public void setGameWon(double playerCash) {
        gamesPlayed ++;
        gamesWon ++;
        // set the credits won
    }

    public void setGameLost(double playerCash) {
        gamesPlayed ++;
		// set credits lost
        }
	/*
	public boolean searchFile() {
		int count = 0;
		
		// Create Scanners for input file
		Scanner inputFile = new Scanner(new File("stats.txt"));
			
			// Read file as long as there is data
			while (inputFile.hasNext()) {	
			
				// Search through the file line by line
				String fileWord = inputFile.nextLine();
				fileWord = fileWord.toLowerCase();
				
					// Compare string equality
				if (playerName.equals(fileWord)) {
					count ++;
				}
				
				if (count == 1) {
					return true;
				} else {
					return false;
				}
			}
		// Close the file
		inputFile.close();
	}*/
